package com.tc.zigbee.zcl.command;

import java.util.LinkedList;
import java.util.List;

import com.tc.util.DataUtil;

public class Report extends AbstractZclCommand{
	public List<AttributeRecord> getAttributes() {
		return attributes;
	}
	List<AttributeRecord> attributes = new LinkedList<AttributeRecord>();
	public Report(byte[] data){
		int i = 0;
		while(i < data.length){

			short attribute = DataUtil.shortValue(data);
			i += 2;
			byte dataType = data[i++];
			DataType dt = DataTypeManager.types.get(dataType);
			DataValue value = dt.value(data, i);
			i += dt.length;
			AttributeRecord r = new AttributeRecord(attribute, (byte)0, value);
			attributes.add(r);

			System.out.println("report：" + r.value);
		}

	}
}
